package com.boilermaker.lotterysystem.service.async.retry;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.concurrent.TimeUnit;

@Getter
@AllArgsConstructor
public class RetryPolicy {

    /**
     * 最大重试次数
     */
    private final int maxAttempts;

    /**
     * 重试等待时间，避免频繁重试
     */
    private final long backoffDelayMs;

    public static RetryPolicy defaultPolicy() {
        return new RetryPolicy(3, 1000);
    }

    public static RetryPolicy noRetry() {
        return new RetryPolicy(1, 0);
    }
}
